using Boo.Lang;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class winlosedrawoneround : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024state_0024509 : GenericGenerator<WaitForSeconds>
	{
		internal winlosedrawoneround _0024self__0024511;

		public _0024state_0024509(winlosedrawoneround self_)
		{
			_0024self__0024511 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024511);
		}
	}

	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024find_0024512 : GenericGenerator<WaitForSeconds>
	{
		internal winlosedrawoneround _0024self__0024514;

		public _0024find_0024512(winlosedrawoneround self_)
		{
			_0024self__0024514 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024514);
		}
	}

	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024Back_0024515 : GenericGenerator<WaitForSeconds>
	{
		internal winlosedrawoneround _0024self__0024517;

		public _0024Back_0024515(winlosedrawoneround self_)
		{
			_0024self__0024517 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024517);
		}
	}

	public localtournament tc;

	public spin Player;

	public spin AI1;

	public spin AI2;

	public spin AI3;

	public GameObject win;

	public GameObject lose;

	public GameObject draw;

	public int stat;

	public threeroundsystemc threeround;

	public bool twoplayer;

	public string curcar;

	public winlosedrawoneround()
	{
		curcar = "career";
	}

	public void Start()
	{
		StartCoroutine(find());
	}

	public void wld()
	{
		if (Player.speed < 10 && AI1.speed > 10)
		{
			Player.CancelInvoke("accel");
			Player.CancelInvoke("touch");
			Player.CancelInvoke("uni");
			lose.active = true;
			if ((bool)threeround)
			{
				threeround.aipoints++;
				threeround.finished();
			}
			tc.won = false;
			stat = 0;
			CancelInvoke();
		}
		if (Player.speed > 10 && AI1.speed < 10)
		{
			Player.CancelInvoke("accel");
			Player.CancelInvoke("touch");
			Player.CancelInvoke("uni");
			win.active = true;
			if ((bool)threeround)
			{
				threeround.playerpoints++;
				threeround.finished();
			}
			tc.won = true;
			stat = 0;
			CancelInvoke();
		}
		if (Player.speed == 0 && AI1.speed == 0)
		{
			Player.CancelInvoke("accel");
			Player.CancelInvoke("touch");
			Player.CancelInvoke("uni");
			win.active = true;
			if ((bool)threeround)
			{
				threeround.playerpoints++;
				threeround.finished();
			}
			tc.won = true;
			stat = 0;
			CancelInvoke();
		}
	}

	public IEnumerator state()
	{
		return new _0024state_0024509(this).GetEnumerator();
	}

	public IEnumerator find()
	{
		return new _0024find_0024512(this).GetEnumerator();
	}

	public void quit()
	{
		tc = (GameObject.Find("tournament controller(Clone)").GetComponent("localtournament") as localtournament);
		tc.played++;
		tc.roundplaying = false;
		StartCoroutine(Back());
	}

	public IEnumerator Back()
	{
		return new _0024Back_0024515(this).GetEnumerator();
	}

	public void Main()
	{
		InvokeRepeating("wld", 7f, 0.7f);
	}
}
